package com.ibm.interfaces;

import com.fasterxml.jackson.databind.node.ArrayNode;
import com.ibm.cps.message.RawDataMessage;
import com.ibm.cps.message.ParsedDataMessage;
import com.ibm.util.exception.CPSException;

public interface ITimeSeriesSchema extends Comparable<ITimeSeriesSchema> {

	/**
	 * the type list of the time series type
	 * 
	 * @return
	 */
	public abstract byte[] getDataTypes();

	/**
	 * the tag list of the time series type
	 * 
	 * @return
	 */
	public abstract String[] getTagNames();

	/**
	 * return the number of the tags
	 * 
	 * @return
	 */
	public abstract int getTagCount();

	/**
	 * get the index of the given tag, starting from 0
	 * 
	 * @param name
	 * @return -1 indicates failure
	 */
	public int getTagId(String name);

	/**
	 * get the schema id
	 * 
	 * @return
	 */
	public abstract String getSchemaID();

	/**
	 * get the id of the user who own this schema
	 * 
	 * @return
	 */
	public abstract String getUserID();

	/**
	 * get tag list
	 * 
	 * @return
	 */
	public abstract ArrayNode getTags();


	/**
	 * build parsed data message from value
	 * @param values
	 * @return
	 * @throws CPSException
	 */
	public abstract ParsedDataMessage buildParsedDataMessage(Comparable[] values)
			throws CPSException;
	
	public byte getDataType(int index);

	public ParsedDataMessage newMessage();

	public int getTimestampIndex();

	public int getKeyIndex();

	String getKeyName();
	/**
	 * return the number index of the tag name; array & object will get the root number 
	 * @param name
	 * @return
	 */
	int getTagNumber(String name);

}